import request from '@/utils/request'

// 获取策略列表
export function getStrategyList(params) {
  return request({
    url: '/strategy/lists',
    method: 'get',
    params: params
  })
}

// 重启策略
export function restartStrategy(id) {
  return request({
    url: '/strategy/restartState',
    method: 'get',
    params: {
      id: id,
      state: 1
    }
  })
}

// 开关策略状态
export function updateStrategyStatus(params) {
  return request({
    url: '/strategy/updateState',
    method: 'get',
    params: params
  })
}

// 初始化请求策略信息
export function getInfo(id) {
  return request({
    url: '/strategy/info',
    method: 'get',
    params: {
      id: id
    }
  })
}

// 获取策略日志
export function getLog(data) {
  return request({
    url: '/strategy/logInfo',
    method: 'post',
    data: data
  })
}

// 更新策略基本信息
export function updateStrategyBasic(data) {
  return request({
    url: '/strategy/updateBasic',
    method: 'post',
    data: data
  })
}

// 更新策略的配置信息
export function updateStrategyConfig(data) {
  return request({
    url: '/strategy/updateConfig',
    method: 'post',
    data: data
  })
}

// 删除策略对应的配置参数
export function deleteStrategyConfig(data) {
  return request({
    url: '/strategy/deleteConfig',
    method: 'post',
    data: data
  })
}

// 新增策略的配置参数
export function addConfig(data) {
  return request({
    url: '/strategy/addConfig',
    method: 'post',
    data: data
  })
}

// 新增策略的配置参数
export function saveStrategy(data) {
  return request({
    url: '/strategy/saveStrategy',
    method: 'post',
    data: data
  })
}

// 删除一条策略信息
export function deleteStrategy(params) {
  return request({
    url: '/strategy/deleteStrategy',
    method: 'post',
    params: params
  })
}

// 获取最新的日志信息
export function getNewLogData(params) {
  return request({
    url: '/strategy/getNewLogData',
    method: 'get',
    params: params
  })
}

// 获取最新的收益曲线信息
export function getNewProfitLog(params) {
  return request({
    url: '/strategy/getNewProfitLog',
    method: 'get',
    params: params
  })
}

// 获取的收益曲线信息
export function getProfitLog(params) {
  return request({
    url: '/strategy/getProfitLog',
    method: 'post',
    data: params
  })
}

// 更新jar包
export function updateJarVersion(params) {
  return request({
    url: '/strategy/updateJar',
    method: 'get',
    params: params
  })
}

// 获取策略对应的持久化信息
export function getOrmData(params) {
  return request({
    url: '/strategy/getOrmData',
    method: 'get',
    params: params
  })
}

// 判断一个策略名是存在
export function isHaveStrategyName(val) {
  return request({
    url: '/strategy/hasStrategyName',
    method: 'get',
    params: {
      name: val
    }
  })
}

// 获取用户对该策略的操作级别
export function getUserStrategyLevel(params) {
  return request({
    url: '/strategy/getUserStrategyLevel',
    method: 'get',
    params: params
  })
}
// 获取用户对该策略的操作级别
export function downloadLogFile(params) {
  return request({
    url: '/strategy/download',
    method: 'get',
    params: params
  })
}

